﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kardex_Entity;

namespace Kardex_DataAccess
{
    public class TypeStatusCivlDA
    {
           bd_kardexEntities context;
           public TypeStatusCivlDA()
        {
            context = new bd_kardexEntities();
        }

        public List<typestatuscivil> GetListAll()
        {
            List<typestatuscivil> ListTypeStatusCivil = null;
            try
            {
                var q = from e in context.typestatuscivil 
                        orderby e.NameTypeStatusCivil
                        select e;
                ListTypeStatusCivil = q.ToList();

                return ListTypeStatusCivil;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }
    }

    public class TypeBusinessDA
    {
        bd_kardexEntities context;
        public TypeBusinessDA()
        {
            context = new bd_kardexEntities();
        }

        public List<typebusiness> GetListAll()
        {
            List<typebusiness> ListTypeBusiness= null;
            try
            {
                var q = from e in context.typebusiness
                        orderby e.NameBusiness
                        select e;
                ListTypeBusiness = q.ToList();

                return ListTypeBusiness;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }
    }

    public class TypeCreditDA
    {
        bd_kardexEntities context;
        public TypeCreditDA()
        {
            context = new bd_kardexEntities();
        }

        public List<typecredit> GetListAll()
        {
            List<typecredit> ListTypeCredit = null;
            try
            {
                var q = from e in context.typecredit
                        orderby e.Days
                        select e;
                ListTypeCredit = q.ToList();

                return ListTypeCredit;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }
    }
}
